﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Data.SqlClient;

/// <summary>
/// Summary description for dataset
/// </summary>
public class dataset
{	
        public String Conn_str = "Data Source=.;Initial Catalog=BookDB;Integrated Security=True";

    public DataSet OPENDATASET(String sql)
    {
        SqlConnection con = new SqlConnection(Conn_str);
        SqlDataAdapter da = new SqlDataAdapter(sql, con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        return ds;
    }

    public bool EXECUTE_SQL(String sql)
    {
        SqlConnection con = new SqlConnection(Conn_str);
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = sql;
        cmd.Connection = con;
        try
        {
            con.Open();
            cmd.ExecuteNonQuery();
            return true;
        }
        catch (Exception )
        {
            return false;
        }
        finally
        {
            con.Close();
        }
    }
	
}
